'\"macro stdmacro
.TH PMLOCALPMDA 3 "" "Performance Co-Pilot"
.SH NAME
\f3__pmLocalPMDA\f1 \- change the table of DSO PMDAs for PM_CONTEXT_LOCAL contexts
.SH "C SYNOPSIS"
.ft 3
#include "pmapi.h"
.br
#include "libpcp.h"
.sp
.ad l
.hy 0
.in +8n
.ti -8n
int __pmLocalPMDA(int \fIop\fP, int \fIdomain\fP, const char *\fIname\fP, const\ char\ *\fIinit\fP);
.sp
.in
.hy
.ad
cc ... \-lpcp
.ft 1
.SH CAVEAT
This documentation is intended for internal Performance Co-Pilot
(PCP) developer use.
.PP
These interfaces are not part of the PCP APIs that are guaranteed to
remain fixed across releases, and they may not work, or may provide
different semantics at some point in the future.
.SH DESCRIPTION
PCP contexts of type
.B PM_CONTEXT_LOCAL
are used by clients that wish to fetch metrics directly from one or more PMDAs on
the local host without involving
.BR pmcd (1).
A PMDA that is to be used in this way must have been built as a
Dynamic Shared Object (DSO).
.P
Historically the table of PMDAs available for use with
.B PM_CONTEXT_LOCAL
was hardcoded to the following:
.IP * 2n
The PMDA (or PMDAs) that export the operating system performance data
and data about process activity.
.PD 0
.IP *
The
.B mmv
PMDA.
.IP *
The
.B sample
PMDA provided
.B $PCP_LITE_SAMPLE
or
.B $PMDA_LOCAL_SAMPLE
is set in the environment \- used mostly for QA and testing.
.PD
.PP
The initial table of PMDAs available for use with
.B PM_CONTEXT_LOCAL
is now generated dynamically from all those PMDAs that have been
installed as DSOs on the local host.
The one exception is the ``pmcd''
PMDA which only operates correctly in the address space of a running
.BR pmcd (1)
process and so is not available to an application using a
.B PM_CONTEXT_LOCAL
context.
.PP
.B __pmLocalPMDA
provides a number of services to amend the table of PMDAs
available for use with
.BR PM_CONTEXT_LOCAL .
.P
The
.I op
argument specifies the what should be done and takes one of the following
values and actions:
.IP PM_LOCAL_ADD 16n
Append an entry to the table for the PMDA with a Performance Metrics Domain
(PMD) of
.IR domain ,
the path to the DSO PMDA is given by
.I path
and the PMDA's initialization routine is
.IR init .
.IP PM_LOCAL_DEL
Removes all entries in the table where the
.I domain
matches, or the
.I path
matches.  Setting the arguments
.I domain
to \-1 or
.I path
to
.B NULL
to force matching on the
.I other
argument.
The
.I init
argument is ignored.
.IP PM_LOCAL_CLEAR
Remove all entries from the table.  All the other arguments are ignored
in this case.
.P
The
.IR domain ,
.I name
and
.I init
arguments have similar syntax and semantics to the associated fields
in the
.BR pmcd (1)
configuration file.
The one difference is the
.I path
argument which is used by
.B __pmLocalPMDA
to find a likely looking DSO by searching in this order:
.B $PCP_PMDAS_DIR\c
/\c
.IR path ,
.IR path ,
.B $PCP_PMDAS_DIR\c
/\c
.I path\c
\&.\c
.I dso-suffix
and finally
.I path\c
\&.\c
.I dso-suffix
(\c
.I dso-suffix
is the local platform specific default file name suffix for a DSO, e.g.
.B so
for Linux,
.B dylib
for Mac OS X,
.B dll
for Windows,
etc.).
.SH "RETURN VALUE"
In most cases,
.B __pmLocalPMDA
returns 0
to indicate success.
If
.I op
is invalid, then the return value is
.B PM_ERR_CONV
else if there is no matching table entry found for a
.B PM_LOCAL_DEL
operation, PM_ERR_INDOM is returned.
.SH SEE ALSO
.BR pmcd (1),
.BR PMAPI (3),
.BR pmNewContext (3)
and
.BR __pmSpecLocalPMDA (3).
